﻿using SqlSugar;

namespace Hsp.WebNovels.Model
{
    /// <summary>
    /// 实体基础类库
    /// </summary>
    public class BaseModel
    {
        #region 分页数据属性

        /// <summary>
        /// 记录行号
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int RowNumber { get; set; }

        /// <summary>
        /// 记录总数
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int RecordCount { get; set; }

        #endregion

        /// <summary>
        /// 子项数量
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public int ChildCount { get; set; }
    }

    /// <summary>
    /// 分页基类
    /// </summary>
    public class PageModel
    {
        #region 分页属性

        /// <summary>
        /// 当前页面页码，从1开始
        /// </summary>
        public int PageNumber { get; set; }

        /// <summary>
        /// 页大小
        /// </summary>
        public int PageSize { get; set; }

        #endregion

        /// <summary>
        /// 分页最小记录行序数
        /// </summary>
        public int MinRow
        {
            get { return (this.PageNumber - 1) * this.PageSize + 1; }
        }

        /// <summary>
        /// 分页最大记录行序数
        /// </summary>
        public int MaxRow
        {
            get { return this.PageNumber * this.PageSize; }
        }
    }
}